#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<math.h>
#if 0
int main() {
	int i = 0;
	for (i = 0; i < 100000; i++)
	{
		int count = 0;
		int tmp = 0;
		int sum = 0;
		tmp = i;
		while (tmp != 0)
		{
			count++;
			tmp /= 10;
		}

		tmp = i;
		
		while (tmp != 0)
		{
			sum += pow(tmp % 10 , count);
			tmp /= 10;
		}
		if (sum == i)
		{
			printf("%d ", sum);
		}
	}
	return 0;
}

int main()
{
	int arr[7] = { 1,2,2,3,1,5,3 };
	int len = sizeof(arr) / sizeof(arr[0]);
	int sum = 0;
	for (int i = 0; i < len; i++)
	{
		sum ^= arr[i];
	}
	printf("%d", sum);
	return 0;
}
#endif


int main()
{
	int n = 0;
	scanf("%d", &n);
	for (int i = 31; i >= 1; i -= 2)
	{
		printf("%d ", ((n>>i) & 1));
	}
	printf("\n");
	for (int j = 30; j >= 0; j -= 2)
	{
		printf("%d ", ((n >> j) & 1));
	}
	return 0;
}